package DBTasks;

import java.sql.PreparedStatement;
import java.sql.SQLException;

public class FosterHomeAssignment extends DBTask {

    private static String afmSQL = "INSERT INTO Fosters "
            + "(Pet_ID, Shelter_Name, Fosterer_Name, Fosterer_Phone) "
            + "VALUES (?, ?, ?, ?)";

    public static boolean assign(int petID, String shelterName,
            String fostererName, String fostererPhone) {
        boolean success = true;

        try {
            PreparedStatement afmQuery = con.prepareStatement(afmSQL);

            afmQuery.setInt(1, petID);
            afmQuery.setString(2, shelterName);
            afmQuery.setString(3, fostererName);
            afmQuery.setString(4, fostererPhone);

            afmQuery.execute();

        }
        catch (SQLException e) {
            e.printStackTrace();
            success = false;
        }

        return success;
    }

}
